﻿@model Model.AppUserList
@{
    ViewBag.Title = "商品货位搬移单管理";
    Layout = "~/Views/Shared/_JQBaseLayOut.cshtml";
}
@section JQscriptSection{
    <script src="../../Scripts/viewsScript/GoodsMove/GoodsMoveC.js" type="text/javascript"></script>
    <script src="../../Scripts/jqueryeasyui/datagrid-detailview.js" type="text/javascript"></script>
    <script src="../../Scripts/jqueryeasyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script src="../../Scripts/Jquery.easy.ui.extend.js" type="text/javascript"></script>
    <script src="../../Scripts/Common.js" type="text/javascript"></script>
    <script type="text/javascript">

            function checkfromlocationcode() {
                var code = $.trim($("#txtFromLocationCode").attr("value"));
                if (code != "") {
                    $('#item').form('submit', {
                        url: "/Location/checkLocationExist?code=" + code,
                        success: function (data) {
                            eval('data=' + data);
                            if (data.success) {

                            } else {
                                $.messager.alert('错误', data.msg, 'error');
                                $("#txtFromLocationCode").val("").focus();
                            }
                        }
                    });
                }
            };

            function checktolocationcode() {
                var code = $.trim($("#txtToLocationCode").attr("value"));
                if (code != "") {
                    $('#item').form('submit', {
                        url: "/Location/checkLocationExist?code=" + code,
                        success: function (data) {
                            eval('data=' + data);
                            if (data.success) {

                            } else {
                                $.messager.alert('错误', data.msg, 'error');
                                $("#txtToLocationCode").val("").focus();
                            }
                        }
                    });
                }
            };
            function checkgoodscode() {
                var code = $.trim($("#txtGoodsCode").attr("value"));
                if (code != "") {
                    $('#item').form('submit', {
                        url: '@Url.Content("~/Location/checkGoodsExist")',
                        success: function (data) {
                            eval('data=' + data);
                            if (data.success) {

                            } else {
                                $.messager.alert('错误', data.msg, 'error');
                                $("#txtGoodsCode").val("").focus();
                            }
                        }
                    });
                }
            };

            function ExporterExcel() {
                var form = $('#query');
                var rows = $(".pagination-page-list option:selected").text();
                var page = $("input[size='2']").val();
                var GoodsMoveID = $.trim($("#hiddenMOVEID").attr("value"));
                form.form('submit', {
                    url: '@Url.Content("~/GoodsMove/ExportExcel")' + '?page=' + page + '&rows=' + rows + '&GoodsMoveID=' + GoodsMoveID,
                    success: function (data) {
                        eval('data=' + data);
                        if (data.success) {
                            InitGrid();
                        } else {
                            $.messager.alert('错误', data.msg, 'error');
                        }
                        //$("#txtOrdSubjectCode").val("");
                    }
                });
            }
            function Import() {
                var form = $('#query');
                form.form('submit', {
                    url: '/GoodsMove/ImportGoodsMoveItem',
                    success: function (data) {
                        eval('data=' + data);
                        if (data.success) {
                            InitGrid();
                        } else {
                            $.messager.alert('错误', data.msg, 'error');
                        }
                    }
                });
            };

    </script>
}

<body style="background-color: ButtonFace; font-size: 17px" @*onload="InitGridMain();"*@>

    <div id="p2" class="easyui-panel" title="查询条件" style="height: 35px; padding: 5px; background: #fafafa;">
        <table>
            <tr>
                <td>商品货位搬移单号:
                </td>
                <td>
                    <input id="txtGoodsMoveID" name="txtGoodsMoveID" style="width: 154px" />
                </td>
                <td>
                    商品编码：
                </td>
                <td>
                    <input id="txtSGoodsCode" name="txtSGoodsCode" style="width: 154px"/>
                </td>
                <td>
                    商品名称：
                </td>
                <td>
                    <input id="txtSGoodsName" name="txtSGoodsName" style="width: 154px"/>
                </td>
                <td>搬移时间：
                </td>
                <td>
                    <input class="easyui-datebox" id="CheckTimeS" name="CheckTimeS" style="width: 140px;" />
                </td>
                <td>~：
                </td>
                <td>
                    <input class="easyui-datebox" id="CheckTimeE" name="CheckTimeE" style="width: 140px;" validtype="compareDate['#CheckTimeS']" />
                </td>
                <td>
                    <a id="btnSerach" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="InitGridMain()">查询</a>
                </td>

            </tr>
        </table>
    </div>
    <div>
        <table id="tab_list">
        </table>
    </div>
    <div id="p1" class="easyui-dialog" style="width: 650px; height: 240px; padding: 10px 20px" closed="true" buttons="#dlg-buttons">
        <form id="location" method="post">
            <table>
                <tr>
                    <td>搬移类型:
                    </td>
                    <td>
                        <input id="hiddenGOODSMOVEID" name="hiddenGOODSMOVEID" type="hidden" />
                        <select id="MoveType" class="easyui-combobox" name="MoveType" style="width: 154px;">
                            <option value="ON">ON</option>
                            <option value="OFF">OFF</option>
                        </select>
                    </td>
                    <td>搬移日期:
                    </td>
                    <td colspan="2">
                        <input class="easyui-datetimebox" id="MoveDate" name="MoveDate" style="width: 154px;" />
                    </td>
                </tr>
                <tr>
                    <td>仓库：</td>
                    <td colspan="3">
                        <select id="WAREHOUSEID" class="easyui-combogrid" name="WAREHOUSEID" style="width: 370px;"
                            data-options="
                        idField:'WAREHOUSEID',
                        textField:'WAREHOUSENAME',
                        url:'@Url.Content("/Location/WarehouseList?IsSetAll=1")',
                        columns:[[
                            {field:'WAREHOUSECODE',title:'编码',width:60},
                            {field:'WAREHOUSENAME',title:'名称',width:100},
                            {field:'SHOPNAME',title:'店铺',width:188}
                        ]]
                    ">
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>库位:
                    </td>
                    <td>
                        <select id="CellNo" class="easyui-combogrid" name="CellNo" style="width: 154px;"
                            data-options="
                        idField:'CELLNO',
                        textField:'CELLNO',
                        url:'@Url.Content("/BaseData/CellNoList")',
                        columns:[[
                            {field:'CELLNO',title:'库位',width:120}
                        ]]
                    ">
                        </select>
                    </td>
                    <td>状态:
                    </td>
                    <td colspan="2">
                        <select id="Flag" class="easyui-combobox" name="Flag" style="width: 154px;">
                            <option value="0">未处理</option>
                            <option value="40">在执行</option>
                            <option value="100">已完结</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>备注:
                    </td>
                    <td colspan="4">
                        <input id="txtRemark" name="txtRemark" maxlength="255" style="width: 520px" />
                    </td>
                </tr>

                <tr>
                    <td colspan="5">
                        <a id="btnSave" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="save()">保存</a>
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <div id="p4" class="easyui-dialog" style="width: 1500px; height: 540px; padding: 10px 20px" closed="true" buttons="#dlg-buttons">
        <form id="query" method="post" enctype="multipart/form-data">
            <table>
                <tr>
                    <td>
                        <input id="FileUpload" type="file" name="files" style="width: 250px; height: 24px; background: White"
                            class="easyui-validatebox" />
                        <a id="btnImport" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-upload'" onclick="Import()">导入</a>
                    </td>
                    <td>
                        <input id="hiddenMOVEID" name="hiddenMOVEID" type="hidden" />
                        <a id="btnExecl" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" onclick="ExporterExcel()">导出</a>
                    </td>
                </tr>
            </table>
            <table id="tab_itemlist">
            </table>
        </form>
    </div>
    <div id="p3" class="easyui-dialog" style="width: 650px; height: 240px; padding: 10px 20px" closed="true" buttons="#dlg-buttons">
        <form id="item" method="post">
            <table>
                <tr>
                    <td>商品货位搬移单号:
                    </td>
                    <td>
                        <input id="hiddenSEQNO" name="hiddenSEQNO" type="hidden" />
                        <input id="GoodsMoveID" name="GoodsMoveID" maxlength="32" style="width: 154px" disabled="disabled" />
                    </td>
                    <td>商品批次号:
                    </td>
                    <td colspan="2">
                        <input id="txtGoodsBatchCode" name="txtGoodsBatchCode" maxlength="32" style="width: 154px" />
                    </td>
                </tr>
                <tr>
                    <td>来源货位编码:
                    </td>
                    <td>
                        <input id="txtFromLocationCode" name="txtFromLocationCode" maxlength="20" style="width: 154px" onblur="checkfromlocationcode()" />
                    </td>
                    <td>目的货位编码:
                    </td>
                    <td colspan="2">
                        <input id="txtToLocationCode" name="txtToLocationCode" maxlength="20" style="width: 154px" onblur="checktolocationcode()" />
                    </td>
                </tr>
                <tr>
                    <td>数量:
                    </td>
                    <td>
                        <input id="txtQty" name="txtQty" maxlength="20" style="width: 154px" />
                    </td>
                    <td>下架指令:
                    </td>
                    <td colspan="2">
                        <input id="txtOffShelvesID" name="txtOffShelvesID" maxlength="20" style="width: 154px" />
                    </td>
                </tr>

                <tr>
                    <td>商品编码:
                    </td>
                    <td colspan="2">
                        <input id="txtGoodsCode" name="txtGoodsCode" maxlength="10" style="width: 154px" onblur="checkgoodscode()" />
                    </td>
                    <td colspan="2">
                        <a id="btnSaveItem" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="saveItem()">保存</a>
                    </td>
                </tr>
            </table>
        </form>
    </div>
</body>
